package com.winqai.web.config;

import com.winqai.web.interceptor.TimeInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class WebConfig extends WebMvcConfigurerAdapter{

    @Autowired
    private TimeInterceptor timeInterceptor;

    //异步请求拦截器的配置
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //registry.addInterceptor(timeInterceptor);
    }

//    @Bean
//    public FilterRegistrationBean timeFilter(){
////        FilterRegistrationBean registrationBean = new FilterRegistrationBean();
////        //与直接用@Component不同的是，可以指定不同的Url上使用
////        TimeFilter timeFilter = new TimeFilter();
////        registrationBean.setFilter(timeFilter);
////
////        List<String> urls = new ArrayList<>();
////        urls.add("/*");
////        registrationBean.setUrlPatterns(urls);
////        return registrationBean;
//    }
}
